package com.example.wifiunlockscreen.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class WifiFriendHelper extends SQLiteOpenHelper {

	


	public static final String TABLE_FRIENDS = "WUS_amigas";
	  public static final String COLUMN_ID = "WUS_id";
	  public static final String COLUMN_NAME = "WUS_nombre";
	  public static final String COLUMN_FAVORITE = "WUS_favorita";

	  private static final String DATABASE_NAME = "wifiUnlockScreen.db";
	  private static final int DATABASE_VERSION = 1;

	  // Database creation sql statement
	  private static final String DATABASE_CREATE = "create table "
	      + TABLE_FRIENDS + "(" + COLUMN_ID
	      + " integer primary key autoincrement, " 
	      + COLUMN_NAME + " text not null,"
	      + COLUMN_FAVORITE + " integer not null);";
	
	
	public WifiFriendHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
		// TODO Auto-generated constructor stub
	}

	
	@Override
	public void onCreate(SQLiteDatabase database) {
		database.execSQL(DATABASE_CREATE);

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		
	    Log.w(WifiFriendHelper.class.getName(),
	            "Upgrading database from version " + oldVersion + " to "
	                + newVersion + ", which will destroy all old data");
	        db.execSQL("DROP TABLE IF EXISTS " + TABLE_FRIENDS);
	        onCreate(db);
	}

}
